package com.wen.controller;

import com.github.pagehelper.PageInfo;
import com.wen.pojo.SysLog;
import com.wen.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author 20212
 * 日志
 */
@Controller
@RequestMapping("/syslog")
public class SysLogController {
    @Autowired
    private SysLogService sysLogService;

    @RequestMapping("/findAll")
    public ModelAndView findAll(@RequestParam(name = "page", required = true, defaultValue = "1") Integer page,
                                @RequestParam(name = "size", required = true, defaultValue = "10") Integer size) throws Exception {
        ModelAndView modelAndView = new ModelAndView();
        List<SysLog> all = sysLogService.findAll(page, size);
        PageInfo pageInfo = new PageInfo(all);
        modelAndView.addObject("pageInfo", pageInfo);
        modelAndView.setViewName("syslog-list");
        return modelAndView;

    }

}
